<template>
  <basic-container>

    <inventory-list ref="inventoryListRef" v-show="showType==='list'" @margin-settings="handleSettings"/>
    <margin-set-content :info="curr" v-if="showType === 'margin-settings'" @back="handleBack"/>
  </basic-container>
</template>

<script>
import inventoryList from "@/views/inventory/inventory-list/components/inventory-list.vue";
import marginSetContent from "@/views/inventory/inventory-list/components/margin-set-content.vue";

export default {
  name: "index",
  components: {marginSetContent, inventoryList},
  data() {
    return {
      showType: 'list',
      curr: {}
    }
  },
  methods: {
    handleBack(flag) {
      this.showType = 'list'
      if(flag) this.$refs.inventoryListRef.query()
    },
    handleSettings(_curr) {
      this.showType = 'margin-settings'
      this.curr = _curr
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
